<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * 学生参加活动记录表
 *
 * @author wutian
 */

namespace Home\Model ;

class UserActivityLinkModel extends \Think\Model
{

    /**
     * 添加学生参加活动记录
     * @param type $UID
     * @param type $ActivityID
     * @param type $ActivityResult
     * @return boolean
     */
    function addUserActivityLink ( $UID , $ActivityID )
    {
        $map[ 'UID' ]        = $UID ;
        $map[ 'ActivityID' ] = $ActivityID ;
        if ( $this->create ( $map ) )
        {
            if ( ! $this->add () )
            {
                return false ;
            }
            return true ;
        }
        return false ;
    }

    function getActivityIDByUID ( $UID )
    {
        $rs = $this->where ( 'UID = "%s"' , $UID )->field ( 'ActivityID' )->select () ;
        return $rs ? $rs : false ;
    }

}
